package com.mqb;

import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * 对于客户端发送的每一个 RequestMsg，服务端都会发送一个 AckMsg 表示收到
 * 必须一对一
 */
@Data
@Accessors(chain = true)
public class AckMsg extends BaseMsg {

    private final static String DEFAULT_SEND_ID = "server";

    /**
     * 发送者id
     */
    private String sendId;

    /**
     * content
     */
    private Result result;

    public AckMsg() {
    }

    public AckMsg(String id, String recId) {
        super.id = id;
        super.msgType = MsgType.ACK.getCode();
        super.recId = recId;
        super.dateTime = LocalDateTime.now();
        this.sendId = DEFAULT_SEND_ID;
    }


    public AckMsg(String id, String recId, String sendId) {
        super.id = id;
        super.msgType = MsgType.ACK.getCode();
        super.recId = recId;
        super.dateTime = LocalDateTime.now();
        this.sendId = sendId;
    }

    public AckMsg(String id, String recId, String sendId, Result result) {
        super.id = id;
        super.msgType = MsgType.ACK.getCode();
        super.recId = recId;
        super.dateTime = LocalDateTime.now();
        this.sendId = sendId;
        this.result = result;
    }


}
